<template>
	<view>
		<uni-nav-bar title="首页"></uni-nav-bar>
		<view class="content">
			页面 - 1
			 <button type="primary" @click="showRichAlert()">Android Toast</button>
		</view>
	</view>
</template>

<script>
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	
	//#ifdef APP-PLUS
	 const modal = uni.requireNativePlugin('modal');
	 const dcRichAlert = uni.requireNativePlugin('DCloud-RichAlert');
	//#endif
	
	export default {
		components: {
			uniNavBar
		},
		data() {
			return {
				title: 'Hello'
			};
		},
		onLoad() {},
		methods: {
				showRichAlert() {
					//#ifdef APP-PLUS
				dcRichAlert.show({
					position: 'bottom',
					title: "提示信息",
					titleColor: '#FF0000',
					content: "<a href='https://uniapp.dcloud.io/' value='Hello uni-app'>uni-app</a> 是一个使用 Vue.js 开发跨平台应用的前端框架!\n免费的\n免费的\n免费的\n重要的事情说三遍",
					contentAlign: 'left',
					checkBox: {
						title: '不再提示',
						isSelected: true
					},
					buttons: [{
							title: '取消'
						},
						{
							title: '否'
						},
						{
							title: '确认',
							titleColor: '#3F51B5'
						}
					]
				}, result => {
					const msg = JSON.stringify(result);
					modal.toast({
						message: msg,
						duration: 1.5
					});
					switch (result.type) {
						case 'button':
							console.log("callback---button--" + result.index);
							break;
						case 'checkBox':
							console.log("callback---checkBox--" + result.isSelected);
							break;
						case 'a':
							console.log("callback---a--" + JSON.stringify(result));
							break;
						case 'backCancel':
							console.log("callback---backCancel--");
							break;
					}
				});
				//#endif
			}
		}
	};
</script>

<style>
	.content {
		text-align: center;
		height: 400upx;
		margin-top: 200upx;
	}
</style>
